import { Component } from 'vue-facing-decorator'
import Render from '@/render/Render'
import toNative from '@/utils/toNative'
import TableRender, { type TableRenderColumnTypes } from '@/render/TableRender'
import type { VxeTableDataRow } from 'vxe-table'
import type { FilterDto } from '@/render/FilterRender'
import { Button } from 'ant-design-vue'

@Component
export class JobAuditView extends TableRender {

    pageTitle = '筛选'

    filterConfig() {
        return {
            companyId: {
                name: '派遣单位',
                element: 'select',
                optionsType: 'company'
            },
            applyPeople: {
                name: '审核方',
                element: 'select',
                options: [
                    {
                        label: '系统',
                        value: 1
                    }
                ]
            },
        } as FilterDto
    }

    tableColumnConfigOld = () => [
        {
            field: 'companyId',
            title: '派遣单位',
        },
        {
            field: 'companyName',
            title: '客户名称',
            width: 200
        },
        {
            field: 'auditStatus',
            title: '审核方',
        },
        {
            field: 'isOpenPaySalary',
            title: '审核视频',
        },
        {
            field: 'isOpenPeriod',
            title: '审核工种',
        },
        {
            field: 'isOpenPeriod',
            title: '申请人',
        },
        {
            field: 'isOpenWesure',
            title: '申请时间',
            width: 160
        },
        {
            field: 'operate',
            title: '操作',
            width: 160,
            fixed: 'right',
            params: {
                buttons: [
                    {
                        text: '通过',
                        event: (row) => {}
                    },
                    {
                        text: '拒绝',
                        event: (row) => {}
                    },
                ]
            },
            slots: {
                default: 'buttons'
            }
        }
    ] as TableRenderColumnTypes<VxeTableDataRow>

    onToHistory() {
        this.$router.push({
            path: '/approval/audit-history'
        })
    }

    renderTitleBtn() {
        return <Button type="link" onClick={this.onToHistory}>历史记录</Button>
    }

    render() {
        return <>
            {super.render()}
        </>
    }
}

export default toNative<{}, {}>(JobAuditView)